package com.baidu.shop.service;

import com.alibaba.fastjson.JSONObject;
import com.baidu.shop.base.Result;
import com.baidu.shop.document.GoodsDoc;
import com.google.gson.JsonObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @Description:
 * @ClassName: ShopElasticsearchService
 * @Author: User
 * @date: 2020.09.16 17:48
 * @version: 1.0
 */
@Api(tags = "es接口")
public interface ShopElasticsearchService {

   /* @ApiOperation(value = "获取商品信息测试")
    @GetMapping(value = "es/saveGoodsInfo")
    Result<JSONObject> saveGoodsInfo();
*/
    //ES数据初始化-->索引创建,映射创建,mysql数据同步
    @ApiOperation(value = "ES商品数据初始化-->索引创建,映射创建,mysql数据同步")
    @GetMapping(value = "es/initGoodsEsData")
    Result<JSONObject> initGoodsEsData(Integer spuId);

    @ApiOperation(value = "清空ES中的商品数据")
    @GetMapping(value = "es/clearGoodsEsData")
    Result<JSONObject> clearGoodsEsData();

    @ApiOperation(value = "搜索")
    @GetMapping(value = "es/search")
    Result<List<GoodsDoc>> search(@RequestParam String search,Integer pages,String filter);

    @ApiOperation(value = "删除")
    @GetMapping(value = "es/deleteById")
    Result<JSONObject> deleteSearchById(@RequestParam String id);
}

